feat: add template-no-duplicate-form-names#2762
Draft
johanrd wants to merge 5 commits intoember-cli:masterfrom
Draft
feat: add template-no-duplicate-form-names#2762johanrd wants to merge 5 commits intoember-cli:masterfrom
johanrd wants to merge 5 commits intoember-cli:masterfrom
Conversation
| // — `disabled="false"` (static string), `disabled={{"false"}}` (string- | ||
| // literal mustache) — still mean disabled per HTML boolean-attribute | ||
| // semantics: presence = disabled regardless of value content. | ||
| function isDisabled(node) { |
Contributor
There was a problem hiding this comment.
do we need this? wouldn't we want to disallow all duplicate names?
Contributor
Author
There was a problem hiding this comment.
thanks, agree, removed now
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Note
This is part of a series where Claude has audited
eslint-plugin-emberagainst jsx-a11y, vuejs-accessibility, angular-eslint, lit-a11y and html-validate,ember-template-lint, and the HTML and WCAG specs.See html-validate
form-dup-namefor the peer rule concept.Adds
template-no-duplicate-form-names: flags two form controls sharing anameattribute within the same<form>(or template root if no enclosing form). Radio groups and repeated submit-type controls are explicitly allowed to share a name.Premise
Per HTML spec §4.10.22.4 — Constructing the entry list, the serializer iterates submittable form controls and emits one entry per contributing control. Two regular controls with the same
nameboth contribute, and server-side frameworks that expect a single value will silently see one — usually not the one the author intended.The spec distinguishes three categories for name-collision purposes:
<input type="button"|"reset">,<button type="button"|"reset">. These do not contribute to the form-data entry list at all; theirnamecan't collide with anything.<input type="radio">, submit-like controls (<input type="submit">,<button type="submit">). Sharing a name with same-type siblings is the legitimate pattern: a radio group, or multiple submits distinguished byvalue.nameis a real collision.Flags
Allows
Scope
This is a v1 implementation. Not ported from html-validate:
name[]array syntax; the<input type="hidden">+<input type="checkbox">default-value pattern. Both are rarely seen in Ember apps; can be added on demand.Opt-in: not added to any preset config.
Prior art
form-dup-name— full implementation withname[]array handling and a complete form-associated-element registryno-duplicate-attributes— different concern (same attribute twice on one element, not samenameacross controls)